Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

configstore

Package Overview
Dependencies
Maintainers
7
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

configstore

Easily load and save config without having to think about where and how

  • 5.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10M
increased by4.57%
Maintainers
7
Weekly downloads
 
Created

What is configstore?

The configstore npm package is used for easily loading and persisting config without having to think about where and how. It's ideal for storing user settings, application configurations, and other data that needs to be saved between sessions.

What are configstore's main functionalities?

Creating and managing a config store

This code demonstrates how to create a new config store associated with a specific package and set default values. It also shows how to retrieve a value from the store.

const Configstore = require('configstore');
const packageJson = require('./package.json');
const conf = new Configstore(packageJson.name, {foo: 'bar'});
console.log(conf.get('foo'));
//=> 'bar'

Setting and getting data

This code shows how to set and get data in the config store. It also demonstrates the use of dot-notation to work with nested properties.

conf.set('awesome', true);
console.log(conf.get('awesome'));
//=> true

// Using dot-notation for nested properties
conf.set('bar.baz', true);
console.log(conf.get('bar'));
//=> { baz: true }

Deleting data

This code snippet illustrates how to delete a key-value pair from the config store.

conf.delete('awesome');
console.log(conf.get('awesome'));
//=> undefined

Accessing the entire store

This code example shows how to access the entire config store, which returns an object containing all the key-value pairs.

console.log(conf.all);
//=> { foo: 'bar', bar: { baz: true } }

Checking if a key exists

This code demonstrates how to check if a particular key exists in the config store.

console.log(conf.has('foo'));
//=> true

Other packages similar to configstore

Keywords

FAQs

Package last updated on 13 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc